from openpyxl import load_workbook

wb = load_workbook("C:/Users/shen/OneDrive/ASM/呆滞分析2023.10.18/库存明细账2023.10.18-matrix.xlsx")
ws = wb["明细矩阵"]
for i in range(2, ws.max_row + 1, 4):
    day_n = 0
    insum = 0
    outsum = 0
    for j in range(5, ws.max_colume + 1, 1):
        insum+=ws.cell(i+2,j).value
        outsum+=ws.cell(i+3,j).value
        if day_n ==0 and ws.cell(i+2, j).value != 0:
            day = ws.max_colume - j
    ws.cell(i,ws.max_colume).value =outsum


    print(i)

print(ws.cell(1, 5).value)
